package com.heima.article.job;

import com.heima.article.service.HotArticleSerivice;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author brianxia
 * @version 1.0
 * @date 2022-09-23 16:36
 */
@Component
@Slf4j
public class HotArticleJob {

    @Autowired
    private HotArticleSerivice hotArticleSerivice;

    @XxlJob("hotArticle")
    public void hotArticle(){
        log.info("热文章计算开始...");

        try{
            hotArticleSerivice.hotArticle();
        }catch (Exception e){
            log.error("定时计算热文章失败",e);
        }


        log.info("热文章计算结束...");
    }
}
